<!--
 * @Author: fangshengchu
 * @Date: 2024-05-10 15:22:30
 * @LastEditTime: 2024-05-10 15:25:13
 * @LastEditors: fangshengchu
 * @Description: 
 * @FilePath: \szhk-fe\src\views\purchaseArrival\moduleCommon\formComp\dataPicker.vue
-->
<template>
  <a-date-picker
    show-time
    :time-picker-props="{ defaultValue: '00:00:00' }"
    format="YYYY-MM-DD HH:mm:ss"
    @change="onChange"
    @select="onSelect"
    @ok="onOk"
  />
</template>

<script setup lang="ts">
  import { ref, watch } from 'vue';

  const props = defineProps({
    value: {
      type: String,
      default: '',
    },
    placeholder: {
      type: String,
      default: '请选择',
    },
  });
  const emit = defineEmits(['update:value']);

  const nowVal = ref(props.value);
  watch(
    () => props.value,
    (newVal) => {
      nowVal.value = newVal;
    }
  );
  const onChange = () => {
    emit('update:value', nowVal.value);
    console.log(nowVal);
  };
  const onSelect = () => {
    console.log(nowVal);
  };
</script>
